﻿package 
{
	import flash.display.Sprite;
	import flash.display.MovieClip;

	public class Grid extends Sprite
	{
		public function Grid()
		{
			name = 'grid';
		}
		
		public function Init(size:Number, lines:Number, x_offset:Number=0, y_offset:Number=0)
		{
			if(!lines > 0 || !size > 0 || !size > 0)
			{
				return void;
			}
			
			var xstep:Number = size / lines;
			var ystep:Number = size / lines;
			
			graphics.clear();
			graphics.lineStyle(1, 0xDDDDDD);
			for (var i:Number = 0; i <= size; i+=xstep) {
				graphics.moveTo(x_offset + i, y_offset);
				graphics.lineTo(x_offset + i, y_offset + size);
			}

			for (var j:Number = 0; j <= size; j+=ystep) {
				graphics.moveTo(x_offset,y_offset+j);
				graphics.lineTo(x_offset + size, y_offset+j);
			}			
		}
	}
}